#pragma once

#include <queue>
#include "SFML/Audio/SoundStream.hpp"
#include <SFML/System/Mutex.hpp>
#include "../Vocoder/Vocoder.h"

typedef std::queue<short> SampleQueue;

class SoundPlayer :
	public sf::SoundStream, public AudioReceiver
{
public:
	SoundPlayer(void);
	~SoundPlayer(void);

	void Initialize(unsigned int ChannelsCount, unsigned int SampleRate);
	bool OnGetData(Chunk& Data);
	void NewSample(short* sample, int length);
	bool HasMoreSamples();

private:
	sf::Mutex mutex;
	SampleQueue buffer;
	short* lastSample;
};
